package com.cyq.day14.game;

public class Hero {
    int hp;
    int atk;
    int def;
    String name;

    public Hero() {
    }

    public Hero(int hp, int atk, int def, String name) {
        this.hp = hp;
        this.atk = atk;
        this.def = def;
        this.name = name;
    }

    public void Fight(Monster m) {
       m.injured(this);

    }
    public void injured(Monster m){
        System.out.println("怪物攻击！");
        int damage=m.atk-this.def;
        this.hp-=damage;
        System.out.println("英雄还剩"+this.hp);
    }
}
